package ua.org.nuos.sdms.clientgui.client.util;

import ua.org.nuos.sdms.clientgui.client.components.window.AbstractWindow;
import ua.org.nuos.sdms.clientgui.server.AppProxy;

import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: dio
 * Date: 08.03.12
 * Time: 17:05
 * To change this template use File | Settings | File Templates.
 */
public class ComponentUtil {

    public static void closeWindow(String windowId) {
        AbstractWindow window = AppProxy.getInstance().getComponentLocator().getWindow(windowId);
        if (window != null) {
            window.close();
        }
    }

    public static void closeAllWindows() {
        for (Map.Entry<String, AbstractWindow> entry : AppProxy.getInstance().getComponentLocator().getWindows().entrySet()) {
            AbstractWindow window = entry.getValue();
            if (window != null) {
                window.close();
            }
        }
    }

}
